import {BasicColumn} from '/@/components/Table';
import {FormSchema} from '/@/components/Table';
import { rules} from '/@/utils/helper/validator';
import { render } from '/@/utils/common/renderUtils';
//列表数据
export const columns: BasicColumn[] = [
  {
    title: '项目名称',
    align:"left",
    dataIndex: 'projectName',
    width: 400
  },
  {
    title: '项目Id',
    align:"left",
    dataIndex: 'id',
    width: 200
  },
  {
    title: '项目序号',
    align:"left",
    dataIndex: 'sortNo'
  },
  {
    title: '所属客户',
    align:"center",
    dataIndex: 'customId_dictText'
  },
  {
    title: '合同额',
    align:"center",
    dataIndex: 'contractAmount'
  },
  {
    title: '去税合同额',
    align:"center",
    dataIndex: 'contractAmountWithoutFax'
  },
  /*   {
      title: '合同状态',
      align:"center",
      dataIndex: 'contractStatus_dictText'
     },*/
  {
    title: '立项状态',
    align:"center",
    dataIndex: 'setupStatus_dictText'
  },
  {
    title: '项目类型',
    align:"center",
    dataIndex: 'type_dictText'
  },
  {
    title: '项目经理',
    align:"center",
    dataIndex: 'pm_dictText'
  },
  {
    title: '项目描述',
    align:"center",
    dataIndex: 'remark'
  },
  {
    title: '运营费率',
    align:"center",
    dataIndex: 'operationPercent'
  },
  {
    title: '运营成本',
    align:"center",
    dataIndex: 'operationAmount'
  },
  {
    title: '利润率',
    align:"center",
    dataIndex: 'kpi'
  },
  {
    title: '利润',
    align:"center",
    dataIndex: 'kpiAmount'
  },
  {
    title: '税点',
    align:"center",
    dataIndex: 'faxPercent'
  },
  {
    title: '税费',
    align:"center",
    dataIndex: 'faxAmount'
  },
  {
    title: '人力成本',
    align:"center",
    dataIndex: 'laborCost'
  },
  {
    title: '差旅成本',
    align:"center",
    dataIndex: 'tripCost'
  },
  {
    title: '供应商成本',
    align:"center",
    dataIndex: 'supplierCost'
  },
/*  {
    title: '其他成本',
    align:"center",
    dataIndex: 'otherCost'
  },*/
  {
    title: '预算总成本',
    align:"center",
    dataIndex: 'totalCost'
  },
  {
    title: '周期',
    align:"center",
    dataIndex: 'cycle'
  },
  //  {
  //   title: '月成本状态',
  //   align:"center",
  //   dataIndex: 'monthCostStatus_dictText'
  //  },
  //  {
  //   title: '年度成本状态',
  //   align:"center",
  //   dataIndex: 'yearCostStatus_dictText'
  //  },
  {
    title: '项目状态',
    align:"center",
    dataIndex: 'projectStatus_dictText'
  },
  {
    title: '开始时间',
    align:"center",
    dataIndex: 'startTime'
  },
  {
    title: '结束时间',
    align:"center",
    dataIndex: 'endTime'
  },
];
//查询数据
export const searchFormSchema: FormSchema[] = [
  {
    label: '项目名称',
    field: 'projectName',
    component: 'JInput',
    colProps: { span: 4 },
  },
  {
    label: '项目序号',
    field: 'sortNo',
    component: 'JInput',
    colProps: { span: 4 },
  },
  {
    field: 'customId',
    component: 'JDictSelectTag',
    componentProps: {
      dictCode: 'monster_custom,name,id'
    },
    label: '所属客户',
    colProps: { span: 4 },
  },
  /*  {
      label: '合同状态',
      field: 'contractStatus',
      component: 'JDictSelectTag',
      componentProps: {
        dictCode: 'contractStatus',
        stringToNumber: true,
      },
      colProps: { span: 4 },
    },*/
  {
    label: '立项状态',
    field: 'setupStatus',
    component: 'JDictSelectTag',
    componentProps: {
      dictCode: 'setupStatus',
      stringToNumber: true,
    },
    colProps: { span: 4 },
  },
  {
    label: '项目类型',
    field: 'type',
    component: 'JDictSelectTag',
    componentProps: {
      dictCode: 'projectType',
      stringToNumber: true,
    },
    colProps: { span: 4 },
  },
  {
    label: '项目状态',
    field: 'projectStatus',
    component: 'JDictSelectTag',
    componentProps: {
      dictCode: 'projectStatus',
      stringToNumber: true,
    },
    colProps: { span: 4 },
  },

  {
    field: 'createBy',
    component: 'JDictSelectTag',
    componentProps: {
      dictCode: 'sys_user,realname,username'
    },
    label: '项目经理',
    colProps: { span: 4 },
  },
  /*  {
      label: '项目状态',
      field: 'projectStatus',
      component: 'JDictSelectTag',
      componentProps: {
        dictCode: 'projectStatus',
        stringToNumber: true,
      },
      colProps: { span: 4 },
    },*/
  /*{
    label: '开始时间',
    field: 'startTime',
    component: 'DatePicker',
    componentProps: {
      showTime: false,
      valueFormat: 'YYYY-MM-DD'
    },
    colProps: { span: 4 },
  },
  {
    label: '结束时间',
    field: 'endTime',
    component: 'DatePicker',
    componentProps: {
      showTime: false,
      valueFormat: 'YYYY-MM-DD'
    },
    colProps: { span: 4 },
  },*/
];
//表单数据
export const formSchema: FormSchema[] = [
  {
    label: '项目名称',
    field: 'projectName',
    component: 'Input',
    required: true,
  },

  {
    field: 'customId',
    component: 'JDictSelectTag',
    componentProps: {
      dictCode: 'monster_custom,name,id'
    },
    label: '客户名称',
    required: true,
  },

  {
    label: '含税合同额',
    field: 'contractAmount',
    componentProps: {
      // suffix: '元',
    },
    component: 'Input',
    required: true,
  },
  /*  {
      label: '合同状态',
      field: 'contractStatus',
      component: 'JDictSelectTag',
      componentProps: {
        dictCode: 'contractStatus',
        stringToNumber: true,
      },
    },*/
  {
    label: '立项状态',
    field: 'setupStatus',
    component: 'JDictSelectTag',
    componentProps: {
      dictCode: 'setupStatus',
      stringToNumber: true,
      disabled: true
    },
  },
  {
    label: '不含税合同额',
    field: 'contractAmountWithoutFax',
    component: 'Input',
    componentProps: {
      // dictCode: 'contractStatus',
      // stringToNumber: true,
      disabled: true
    },
  },
  {
    label: '项目类型',
    field: 'type',
    slot: 'type',
    component: 'JDictSelectTag',
    componentProps: {
      dictCode: 'projectType',
      stringToNumber: true,
    },
    // required: true,
  },
  {
    label: '税率',
    field: 'faxPercent',
    component: 'Input',
    required: true,
    componentProps: {
      disabled: true
    },
  },
  {
    label: '税费',
    field: 'faxAmount',
    component: 'InputNumber',
    componentProps: {
      disabled: true
    },
  },
  {
    label: '运营占比',
    field: 'operationPercent',
    component: 'Input',
  },
  {
    label: '运营成本',
    field: 'operationAmount',
    component: 'Input',
    componentProps: {
      disabled: true
    },
  },
  {
    label: '利润率',
    field: 'kpi',
    component: 'Input',
  },
  {
    label: '利润',
    field: 'kpiAmount',
    component: 'InputNumber',
    componentProps: {
      disabled: true
    },
  },

  {
    label: '人力成本',
    field: 'laborCost',
    component: 'InputNumber',
    defaultValue: 0,
    required: true,
  },
  {
    label: '差旅成本',
    field: 'tripCost',
    component: 'InputNumber',
    defaultValue: 0,
    required: true,
  },
  {
    label: '第三方成本',
    field: 'supplierCost',
    component: 'InputNumber',
    defaultValue: 0,
    required: true,
  },
  /*  {
      label: '其他成本',
      field: 'otherCost',
      component: 'InputNumber',
      defaultValue: 0,
      required: false,
    },*/
  {
    label: '成本总预算',
    field: 'totalCost',
    component: 'Input',
    defaultValue: 0,
    componentProps: {
      disabled: true
    },
  },
  {
    label: '开始时间',
    field: 'startTime',
    component: 'DatePicker',
    required: true,
    componentProps: {
      showTime: false,
      valueFormat: 'YYYY-MM-DD'
    },
  },

  {
    label: '周期',
    field: 'cycle',
    component: 'Input',
    componentProps: {
      suffix: '天',
      disabled: true
    },
  },
  {
    label: '结束时间',
    field: 'endTime',
    component: 'DatePicker',
    required: true,
    componentProps: {
      showTime: false,
      valueFormat: 'YYYY-MM-DD'
    },
  },
  // {
  //   label: '月成本状态',
  //   field: 'monthCostStatus',
  //   component: 'JDictSelectTag',
  //   componentProps: {
  //     dictCode: 'monthCostStatus',
  //     stringToNumber: true,
  //     disabled: true
  //   },
  // },
  // {
  //   label: '年成本状态',
  //   field: 'yearCostStatus',
  //   component: 'JDictSelectTag',
  //   componentProps: {
  //     dictCode: 'yearCostStatus',
  //     stringToNumber: true,
  //     disabled: true
  //   },
  // },

  /*  {
      label: '项目状态',
      field: 'projectStatus',
      component: 'JDictSelectTag',
      componentProps: {
        dictCode: 'projectStatus',
        stringToNumber: true,
      },
    },*/

  {
    label: '项目经理',
    field: 'createBy',
    component: 'Input',
    componentProps: {
      disabled: true
    },
  },

  {
    label: '项目描述',
    field: 'remark',
    component: 'InputTextArea',
  },
  {
    field: 'uploadFile',
    component: 'JUpload',
    helpMessage: '附件上传',
    label: '附件上传',
    componentProps:{
      returnUrl: false
    }
  },
  // TODO 主键隐藏字段，目前写死为ID
  {
    label: '',
    field: 'id',
    component: 'Input',
    show: false
  },
];

//表单数据
export const rocFormSchema: FormSchema[] = [
  {
    label: '项目名称',
    field: 'projectName',
    component: 'Input',
    required: true,
  },

  {
    field: 'customId',
    component: 'JDictSelectTag',
    componentProps: {
      dictCode: 'monster_custom,name,id'
    },
    required: true,
    label: '客户名称',
  },

  {
    label: '合同额',
    field: 'contractAmount',
    component: 'InputNumber',
    defaultValue: 0,
    required: true,
  },
  {
    label: '不含税合同额',
    field: 'contractAmountWithoutFax',
    component: 'InputNumber',
    defaultValue: 0,
    required: true,
  },
  /*  {
      label: '合同状态',
      field: 'contractStatus',
      component: 'JDictSelectTag',
      componentProps: {
        dictCode: 'contractStatus',
        stringToNumber: true,
      },
    },*/
  {
    label: '立项状态',
    field: 'setupStatus',
    component: 'JDictSelectTag',
    componentProps: {
      dictCode: 'setupStatus',
      stringToNumber: true,
      disabled: true
    },
  },
  {
    label: '项目类型',
    field: 'type',
    component: 'JDictSelectTag',
    componentProps: {
      dictCode: 'projectType',
      stringToNumber: true,
    },
    required: true,
  },
  {
    label: '税点',
    field: 'faxPercent',
    component: 'InputNumber',
    componentProps: {
      disabled: true
    },
  },
  {
    label: '税点',
    field: 'faxAmount',
    component: 'InputNumber',
    componentProps: {
      disabled: true
    },
  },
  {
    label: '运营占比',
    field: 'operationPercent',
    component: 'InputNumber',
    componentProps: {
      disabled: true
    },
  },
  {
    label: '运营费用',
    field: 'operationAmount',
    component: 'InputNumber',
    componentProps: {
      disabled: true
    },
  },
  {
    label: '利润率',
    field: 'kpi',
    component: 'InputNumber',
    componentProps: {
      disabled: true
    },
  },
  {
    label: '利润',
    field: 'kpiAmount',
    component: 'InputNumber',
    componentProps: {
      disabled: true
    },
  },

  {
    label: '人力成本',
    field: 'laborCost',
    component: 'InputNumber',
    defaultValue: 0,
    required: true,

  },
  {
    label: '差旅成本',
    field: 'tripCost',
    component: 'InputNumber',
    defaultValue: 0,
    required: true,
  },
  {
    label: '第三方成本',
    field: 'supplierCost',
    component: 'InputNumber',
    defaultValue: 0,
    required: true,
  },
  /*  {
      label: '其他成本',
      field: 'otherCost',
      component: 'InputNumber',
      defaultValue: 0,
      required: true,
    },*/
  {
    label: '总成本',
    field: 'totalCost',
    component: 'Input',
    componentProps: {
      disabled: true
    },
    defaultValue: 0,
    required: true,
  },
  {
    label: '周期',
    field: 'cycle',
    component: 'Input',
    componentProps: {
      suffix: '天',
      disabled: true
    },
  },
  // {
  //   label: '月成本状态',
  //   field: 'monthCostStatus',
  //   component: 'JDictSelectTag',
  //   componentProps: {
  //     dictCode: 'monthCostStatus',
  //     stringToNumber: true,
  //     disabled: true
  //   },
  // },
  // {
  //   label: '年成本状态',
  //   field: 'yearCostStatus',
  //   component: 'JDictSelectTag',
  //   componentProps: {
  //     dictCode: 'yearCostStatus',
  //     stringToNumber: true,
  //     disabled: true
  //   },
  // },

  {
    label: '项目状态',
    field: 'projectStatus',
    component: 'JDictSelectTag',
    componentProps: {
      dictCode: 'projectStatus',
      stringToNumber: true,
    },
  },
  {
    label: '开始时间',
    field: 'startTime',
    component: 'DatePicker',
    componentProps: {
      showTime: false,
      valueFormat: 'YYYY-MM-DD'
    },
    required: true,
  },
  {
    label: '结束时间',
    field: 'endTime',
    component: 'DatePicker',
    componentProps: {
      showTime: false,
      valueFormat: 'YYYY-MM-DD'
    },
    required: true,
  },
  {
    label: '项目经理',
    field: 'pm',
    component: 'Input',
    componentProps: {
      disabled: true
    },
  },
  {
    label: '项目描述',
    field: 'remark',
    // border: 'left',
    component: 'InputTextArea',
  },
  {
    field: 'uploadFile',
    component: 'JUpload',
    helpMessage: '附件上传',
    border: 'left',
    label: '附件上传',
    componentProps:{
      returnUrl: false
    }
  },
  // TODO 主键隐藏字段，目前写死为ID
];



/**
 * 流程表单调用这个方法获取formSchema
 * @param param
 */
export function getBpmFormSchema(_formData): FormSchema[]{
  // 默认和原始表单保持一致 如果流程中配置了权限数据，这里需要单独处理formSchema
  return formSchema;
}
